using System;
using System.Globalization;

namespace UI.Models.Catalog
{
    class ItemDetailsViewModelFactory
    {
        internal ItemDetailsViewModel CreateFrom(Core.Model.Item item, string pictureFilePath)
        {
            if (item == null) throw new ArgumentNullException("item");
            var viewModel = new ItemDetailsViewModel
                                {
                                    ItemId = item.ItemId,
                                    Name = item.Name,
                                    Price = item.Price.ToString(CultureInfo.InvariantCulture),
                                    Quantity = item.Quantity.ToString(CultureInfo.InvariantCulture),
                                    ProductDescription = item.Product.Description,
                                    ProductName= item.Product.Name,
                                    PictureFilePath = pictureFilePath
                                };
            return viewModel;
        }
    }
}
